<script setup>
import { onLaunch, onShow, onHide, onLoad } from '@dcloudio/uni-app';
import { useSysStore } from '@/store/sys';
import { useUserStore } from './store/user';
import { useShopStore } from './store/shop';
const sysStore = useSysStore();
const userStore = useUserStore();
const shopStore = useShopStore();
function calcNavBarInfo() {
  const systemInfo = uni.getSystemInfoSync();
  const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  // console.log('systemInfo', systemInfo.screenWidth)
  const navBarHeight =
    (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 +
    menuButtonInfo.height +
    systemInfo.statusBarHeight;
  console.log('navBarHeight', navBarHeight);
  sysStore.setNavBarHeight(navBarHeight);
  sysStore.setScreenWidth(systemInfo.screenWidth);
  sysStore.setStatusBarHeight(systemInfo.statusBarHeight);
}
onLaunch(() => {
  console.log('App Launch');
  calcNavBarInfo();
  sysStore.getAddressList();
  userStore.validVersion();
  userStore.getUserInfo();
  userStore.getWxSessionKey();
});
onShow(() => {
  console.log('App Show');
  shopStore.getNearbyShop();
});
</script>

<style lang="scss">
/*每个页面公共css */
page {
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: $bg-content;
}
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
.flexc {
  display: flex;
  flex-direction: column;
}
.flexr {
  display: flex;
  flex-direction: row;
}
.align-center {
  align-items: center;
}
.align-self-center {
  align-self: center;
}
.align-self-stretch {
  align-self: stretch;
}
.justify-center {
  justify-content: center;
}
.justify-flex-end {
  justify-content: flex-end;
}
.justify-spacebwt {
  justify-content: space-between;
}
.justify-space-around {
  justify-content: space-around;
}
.flex-1 {
  flex: 1;
}
.flex-wrap {
  flex-wrap: wrap;
}
.primary-button {
  height: 80rpx;
  font-size: 34rpx;
  border-radius: 40rpx;
  background-color: $primary-color;
  overflow: hidden;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}
.primary-button-stroke {
  height: 80rpx;
  border-radius: 40rpx;
  background-color: white;
  overflow: hidden;
  color: $primary-color !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2rpx solid $primary-color !important;
  transition: border-color 0.3s;
}
.disable-button {
  background-color: $disable-color;
  pointer-events: none;
  border-color: $disable-color;
}
.cancel-button {
  height: 80rpx;
  font-size: 34rpx;
  border-radius: 40rpx;
  background-color: white;
  overflow: hidden;
  color: rgba(102, 102, 102, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2rpx solid rgba(0, 0, 0, 0.1);
}
.divider {
  height: 1px;
  background-color: $divider-color;
}
.divider2 {
  height: 1px;
  background-color: $divider-color2;
}
.bottom-divider {
  border-bottom: 1px solid $divider-color;
}
.text-color1 {
  color: $text-color1;
}
.text-color2 {
  color: $text-color2;
}
.text-color3 {
  color: $text-color3;
}
.text-color4 {
  color: $text-color4;
}
.text-color5 {
  color: $text-color5;
}
.text-color-primary {
  color: $primary-color;
}
.line-1 {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.overflow-hidden {
  overflow: hidden;
}
.text-center {
  text-align: center;
}
</style>
